#include "ContraStateDead.h"




void ContraStateDead::update()
{
	if (delayForDead > 0) {
		_data->rect->Vx = 0;
		return;
	}
	_data->sprites->setState(_STATE_CONTRA_DEAD);
	_data->sprites->updateCurrent();
	_data->rect->X += _data->rect->Vx;
}

void ContraStateDead::draw(long time)
{
	_data->sprites->draw();
	if (_data->sprites->currentSprite->endOfSheet()) {
		if  (delayForDead == 0)
			delayForDead = 50;
		else {
			delayForDead--;
		}
		if (delayForDead == 0) {
			_data->isDead = false;
			_data->rect->Height = 75;
			_data->rect->Y = _data->deady + 50;
		}
	}
}

ContraStateDead::ContraStateDead(ContraData* data)
{
	_data = data;
	delayForDead = 0;
}
